import 'package:flutter/material.dart';

class ImageLoader {
  /// 加载本地资源图片
  static Widget asset({
    required String path,
    double? width,
    double? height,
    BoxFit fit = BoxFit.cover,
    BorderRadius? borderRadius,
  }) {
    return ClipRRect(
      borderRadius: borderRadius ?? BorderRadius.zero,
      child: Image.asset(
        path,
        width: width,
        height: height,
        fit: fit,
        cacheWidth: width != null ? (width * 3).toInt() : null,
        filterQuality: FilterQuality.high,
      ),
    );
  }
}
